import {resolve} from 'path'
import {defineConfig} from 'vite'

import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import {NaiveUiResolver} from 'unplugin-vue-components/resolvers'
import AutoImport from 'unplugin-auto-import/vite'
import Pages from 'vite-plugin-pages'
import Layouts from 'vite-plugin-vue-layouts';
import path from 'path'
import createSvgIconsPlugin from 'vite-plugin-svg-icons'


export default defineConfig({
    resolve: {
        alias: [
            {
                find: '@/',
                replacement: path.resolve(process.cwd(), 'src') + '/'
            }
        ],
    },
    plugins: [
        vue(),
        createSvgIconsPlugin.default({
            iconDirs: [path.resolve(process.cwd(), 'src/icons')],
            symbolId: 'icon-[dir]-[name]',
        }),
        Layouts(),
        Pages({
            dirs: [
                {dir: 'src/pages', baseRoute: ''}
            ]
        }),
        Components({
            resolvers: [NaiveUiResolver()]
        }),
        AutoImport({
            imports: ['vue', 'vue-router', 'pinia'],
            resolvers: [NaiveUiResolver()]
        }),
    ],
    css: {
        preprocessorOptions: {
            scss: {
                additionalData: '@use "./src/styles/variables.scss" as *;',
            },
        },
    }
})
